import jsonData from "../../server/data.js";
const app = getApp();
Page({
    data: {
        tourList: [],
        tempTourList:[],
        flag : false
    },
    doDetail: function (e) {
        wx.navigateTo({
            url: '/pages/detail/detail'
        })
    },
    onShow: function(){
        this.setData({tourList:jsonData.tourList,flag:false});
        let areaId = app.globalData.areaId;
        if (areaId != 0) {
            let tempList = this.data.tourList.filter(element => element.areaId == areaId);
            if(tempList.length==0){
                this.setData({flag:true});
            }
            this.setData({tempTourList:tempList});
        } else {
            this.setData({tempTourList:this.data.tourList});
        }
        app.globalData.areaId = 0;
    }
})